#!/usr/bin/lua
require "apm_core"

local G_DEBUG = false

if G_DEBUG == false then
    function logDebug(fmt,...) end
    function logInfo(fmt,...) end
    function logWarn(fmt,...) end
    function logError(fmt,...) end
    function logFatal(fmt,...) end
end
-- return 1: 该数据不上报;其它:上报数据
function post_analysis()
    local ApmData = require("ApmData")
    if ApmData.getL7Proto() ~= 1414 then return end

    local s_em_type = ApmData.getMsgType()
    if s_em_type == nil then
        return
    end

    logInfo("test for cnaps2")
	
	local s_src_ip = ApmData.getSrcIp();
    local s_type_code = ApmData.getField("transaction.type_code", 1);
	if s_src_ip == "10.0.243.86" and s_type_code ~= nil then
        ApmData.replaceField("transaction.channel_name", "网上银行")
        ApmData.replaceField("transaction.channel_code", "EBNK")
    end

    return
end
